/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import React, { useRef } from 'react';
import ProList from '@ant-design/pro-list';
import type { ActionType } from '@ant-design/pro-table';
import type { ListItem } from '../_utils/type';
import { Button } from 'antd';
import { useSmsExamine } from '../_utils/index';
import styles from './index.less';
import AuditContent from '../audit/content';
import AuditTitle from '../audit/title';

const KbSmsAudited = () => {
  const actionRef = useRef<ActionType>();
  const { getList, pagination, reload, handleUpdate, handleJump } = useSmsExamine({
    key: 'approved',
    actionRef,
  });

  return (
    <ProList<ListItem>
      actionRef={actionRef}
      className={styles.smsAudited}
      itemLayout='vertical'
      rowKey='id'
      request={getList}
      pagination={pagination}
      toolBarRender={() => {
        return [
          <Button key='reload' onClick={reload} type='primary'>
            刷新
          </Button>,
        ];
      }}
      search={{}}
      metas={{
        cm_phone: {
          valueType: 'text',
          search: true,
          fieldProps: {
            placeholder: '请输入驿站/快递员手机号',
          },
        },
        subTitle: {
          render: (_, record) => <AuditTitle record={record} handleUpdate={handleUpdate} />,
          search: false,
        },
        content: {
          render: (_, record) => <AuditContent record={record} handleJump={handleJump} />,
          search: false,
        },
      }}
    />
  );
};

export default KbSmsAudited;
